package com.jiangnan.warehouse_management.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.sql.Timestamp;

@TableName("users")
@Data
public class User {
    @TableId(type = IdType.ASSIGN_ID)  // 改为雪花算法
    private Integer userId;
    private String username;
    private String password;
    private String realName;
    private String phone;
    private String email;
    private String role; // 'admin', 'manager', 'operator'
    private Boolean status;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT) // 仅插入时填充
    private Timestamp createdAt;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT_UPDATE) // 插入和更新时都填充
    private Timestamp  updatedAt;
}